<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>录入新题目</title>
<link href="../css/ls2.css" rel="stylesheet" type="text/css" />
<link href="../images/skin.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style>
.comment {
	background: url(../image/login2.jpg) no-repeat;
	width: 700px;
	height: 25px;
	font-size: 14px;
	text-align: left;
	color: #5e8fc9;
	text-indent: 20px;
}
</style>
<script src="../scripts/jquery-1.3.1.js" type="text/javascript"></script>
<script>
	$(function() {
		bindListener();
		$()
				.ready(
						function() {
							$
									.getJSON(
											'http://localhost:8080/bysj/project/showGraduateProjectListJson.html',
											function(data) {
												$('#resText').empty();
												var html = '';
												$
														.each(
																data.graduateProjectList,
																function(
																		commentIndex,
																		comment) {
																	html += '<div class="tm4"><div class="tm1">'
																			+ comment.title
																			+ '</div> <div class="tm2">'
																			+ comment['leibie']
																			+ '</div> <div class="tm2">'
																			+ comment['leixing']
																			+ '</div> <div class="tm2">'
																			+ comment['xianxuan']
																			+ '</div><div name="rmlink1" class="tm3"><a href="#" name="rmlink" class="del">修改</a></div> <div name="rmlink" class="tm3"><a href="#" name="rmlink" class="del">删除</a></div></div>';
																})
												$('#resText').html(html);
												bindListener();
											})
							$("#title").attr("value", "");						

						})

		$("#sub")
				.click(
						function() {
							$
									.get(
											"get3.jsp",
											{
												title : encodeURI($("#title")
														.val()),
												leibie : encodeURI($("#leibie")
														.val()),
												leixing : encodeURI($(
														"#leixing").val()),
												zhuanye : encodeURI($(
														"#zhuanye").val())
											},
											function(data, textStatus) {

												var title = data.title;
												var leibie = data.leibie;
												var leixing = data.leixing;
												var zhuanye = data.zhuanye;
												title = decodeURI(title);
												leibie = decodeURI(leibie);
												leixing = decodeURI(leixing);
												zhuanye = decodeURI(zhuanye);
												var txtHtml = '<div class="tm4"><div class="tm1" name="title">'
														+ title
														+ '</div><div class="tm2" name="leibie">'
														+ leibie
														+ '</div><div class="tm2" name="leixing">'
														+ leixing
														+ '</div><div class="tm2" name="zhuanye">'
														+ zhuanye
														+ '</div> <div name="rmlink1" class="tm3"><a href="#" name="rmlink" class="del">修改</a></div><div class="tm3" name="rmlink"><a href="#" name="rmlink">删除</a></div></div>';
												$("#resText").append(txtHtml);
												bindListener();// 把返回的数据添加到页面上
											}, "json");
						})

	})
	function bindListener() {
		$(".tm3").click(function() {
			$(this).parent().remove();
			var txt = $(this).text();
			var rtitle = $(this).parent().children(".tm1").text();
			var rleibie = $(this).parent().children(".tm2").eq(0).text();
			var rleixing = $(this).parent().children(".tm2").eq(1).text();
			var rzhuanye = $(this).parent().children(".tm2").eq(2).text();

			if (txt == "修改") {
				$("#title").val(rtitle);
				$("#leibie").val(rleibie);
				$("#leixing").val(rleixing);
				$("#zhuanye").val(rzhuanye);
			}
		})
	}
</script>

</head>
<body onload="">
	<div id="contain">
		<table width="100%" border="0" cellpadding="0" cellspacing="0"
			class="tab1">
			<tr>
				<td width="17" valign="top" background="../images/mail_leftbg.gif">
					<img src="../images/left-top-right.gif" width="17" height="29" />
				</td>
				<td valign="top" background="../images/content-bg.gif"><table
						width="100%" height="31" border="0" cellpadding="0"
						cellspacing="0" class="left_topbg" id="table2">
						<tr>
							<td height="31"><div class="titlebt">录入新题目</div></td>
						</tr>
					</table></td>
			</tr>
		</table>

		<div id="main1">
			<div class="comment">
				<c:url var="showGraduateProjectList_url"
					value="/project/showGraduateProjectListJson.html" />

				<a href="${showGraduateProjectList_url}">显示毕业设计题目(JSON)</a>
				<p>
					<b>已有题目</b> <input type="button" id="send" value="加载" />
				</p>
			</div>
			<div class="tm">
				<div class="tm1">题目名称</div>
				<div class="tm2">题目类别</div>
				<div class="tm2">题目类型</div>
				<div class="tm2">限选专业</div>
				<div class="tm5">
					<p style="margin-top: 5px;">操作</p>
				</div>
			</div>
			<div id="resText"></div>

		</div>

		<div id="main2">
			<div class="title2">
				<p>
					<b>录入题目</b>
				</p>
			</div>
			<form id="form1">

				<p>
					题目名称: <input type="text" name="title" id="title" />
				</p>
				<p>
					题目类别: <select id="leibie" name="leibie"><option value="设计">设计</option>
						<option value="论文">论文</option></select>
				</p>
				<p>
					题目类型: <select id="leixing" name="leixing"><option
							value="应用设计">应用设计</option>
						<option value="数学研究">数学研究</option></select>
				</p>
				<p>
					限选专业: <select id="zhuanye" name="zhuanye"><option
							value="信管">信管</option>
						<option value="工业">工业</option>
						<option value="土管">土管</option></select>
				</p>
				<p>
					<input type="button" id="sub" value="提交" />
				</p>
			</form>



		</div>
	</div>





</body>

</html>